home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / python2.4 / test / test_cookie.pyc (.txt) < prev    next >
Python Compiled Bytecode  |  2005-10-18  |  2KB  |  44 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.4)
  3.  
  4. from test.test_support import verify, verbose, run_doctest
  5. import Cookie
  6. import warnings
  7. warnings.filterwarnings('ignore', '.* class is insecure.*', DeprecationWarning)
  8. cases = [
  9.     ('chips=ahoy; vienna=finger', {
  10.         'chips': 'ahoy',
  11.         'vienna': 'finger' }),
  12.     ('keebler="E=mc2; L=\\"Loves\\"; fudge=\\012;";', {
  13.         'keebler': 'E=mc2; L="Loves"; fudge=\n;' }),
  14.     ('keebler=E=mc2;', {
  15.         'keebler': 'E=mc2' })]
  16. for data, dict in cases:
  17.     C = Cookie.SimpleCookie()
  18.     C.load(data)
  19.     print repr(C)
  20.     print str(C)
  21.     for k, v in sorted(dict.iteritems()):
  22.         print ' ', k, repr(C[k].value), repr(v)
  23.         verify(C[k].value == v)
  24.         print C[k]
  25.     
  26.  
  27. C = Cookie.SimpleCookie()
  28. C.load('Customer="WILE_E_COYOTE"; Version=1; Path=/acme')
  29. verify(C['Customer'].value == 'WILE_E_COYOTE')
  30. verify(C['Customer']['version'] == '1')
  31. verify(C['Customer']['path'] == '/acme')
  32. print C.output([
  33.     'path'])
  34. print C.js_output()
  35. print C.js_output([
  36.     'path'])
  37. C = Cookie.SimpleCookie()
  38. C.load('Customer="WILE_E_COYOTE"; Version="1"; Path="/acme"')
  39. verify(C['Customer'].value == 'WILE_E_COYOTE')
  40. verify(C['Customer']['version'] == '1')
  41. verify(C['Customer']['path'] == '/acme')
  42. print "If anything blows up after this line, it's from Cookie's doctest."
  43. run_doctest(Cookie)
  44.